<html>
<head>
	<meta charset="UTF-8"/>
	<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
	<title>吃货餐厅</title>
	<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.5/themes/metro/easyui.css"/>
    <link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.5/themes/mobile.css"/>
	<link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.5/themes/icon.css"/>
	<script type="text/javascript" src="js/jquery-easyui-1.5/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery-easyui-1.5/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="js/jquery-easyui-1.5/jquery.easyui.mobile.js"></script>
    
    <script type="text/javascript">
	 /*<![CDATA[*/ 
	$(document).ready(  
			  function(){
				  getEvaluate();
	 });
	 
	 function getEvaluate()
	 {
		 var orgid =$("#orderid").val();
		 
		 var url ="getEvaluate?orgid="+orgid;
		 
		 $.get(url, function(data){

			if(typeof(data.score)=="undefined")
			{
				return;
			}else
			{
				var exp="input[name='ev'][value="+data.score+"]";
				$(exp).attr("checked",true);
				
			    $("#remark").val(data.remark);
			}
        	 
         });
	 }
	 

	
	 function actionurl()
	 {
		 
		var score=  $("input[name='ev']:checked").val();
		if(typeof(score)=="undefined")
		{ 
			$('#dlg1').dialog('open').dialog('center');
			return;
		}
		
		var re = $("#remark").val();
		
		
		if(re.length==0)
		{
			$('#aler').dialog('open').dialog('center');
			 	return;
		}
		
		 var remark = encodeURIComponent(re);
		 
		 var orderid=$("#orderid").val();
		 var foodid=$("#foodid").val();
		 
         
         var url ="addEvaluate?foodid="+foodid+"&orderid="+orderid+"&remark="+remark+"&score="+score;
         $.get(url, function(data){
        	 history.go(-1);
         });
 		 
	 }
	 
	/*]]>*/  
	</script>
  <style type="text/css">
	.comments {
 		width:100%;/*自动适应父布局宽度*/
 		overflow:auto;
 		word-break:break-all;
						/*在ie中解决断行问题(防止自动变为在一行显示，主要解决ie兼容问题，ie8中当设宽度为100%时，文本域类容超过一行时，
						当我们双击文本内容就会自动变为一行显示，所以只能用ie的专有断行属性“word-break或word-wrap”控制其断行)*/
	}
</style>



</head>
<body>
	<div class="easyui-navpanel">
	
        <header>
            <div class="m-toolbar" >
                <div class="m-title">评价</div>
                <div class="m-left">
                    <a href="javascript:void(0)" class="easyui-linkbutton m-back" plain="true" outline="true" onclick="history.go(-1)">返回</a>
                </div>
                <div class="m-right">
                    <a href="javascript:void(0)" class="easyui-linkbutton" plain="true" outline="true" onclick="actionurl()">提&nbsp;&nbsp;交</a>
                </div>
            </div>
        </header>
        
          	 		<table border="1"  width="100%" height="100px" style="border-style: solid;border-width: 0 0 1px 0;border-color: #ddd;">
          	 			<tr>
          	 				<td style="border: none;" width="50%" height="100px" ><img width="100%" height="100%" th:src="'/myres/'+${food.image}"/></td>
          	 				<td style="border: none;" width="50%" height="100px" >
          	 					<table width="100%" height="100px" >
          	 					
          	 						<tr><td height="50%" style="border: none;"><span style="font-size: 30px;font-family:'微软雅黑';" th:text="${food.foodname}"/></td></tr>
          	 						<tr><td height="30%" style="border: none;"><span style="font-size: 20px;color: #009900;font-family:'微软雅黑';" th:text="${food.price}+' 元'"/></td></tr>
          	 						
          	 					</table>
          	 				</td>
          	 			</tr>
          	 			
          	 		</table>
          	 		<table width="100%">
          	 		<tr><td align="center" >
          	 			极差<input type="radio" name="ev" value="0" />&nbsp;&nbsp;&nbsp;
          	 			差<input type="radio" name="ev" value="25" />&nbsp;&nbsp;&nbsp;
          	 			一般<input type="radio" name="ev" value="50" />&nbsp;&nbsp;&nbsp;
          	 			好<input type="radio" name="ev" value="75" />&nbsp;&nbsp;&nbsp;
          	 			非常好<input type="radio" name="ev" value="100" />&nbsp;&nbsp;&nbsp;
          	 			
          	 			</td></tr>
          	 		</table>
          	 		
          	 		<div>
					<textarea class="comments" id="remark" cols="10"   placeholder="味道如何评价一下吧！" rows="4"></textarea>
					</div>
					
		<div id="dlg1" class="easyui-dialog" style="padding:20px 6px;width:80%;" data-options="inline:true,modal:true,closed:true,title:'提示'">
			<center><div>请您给本菜打一下分数</div></center>
			<div class="dialog-button">
				<a href="javascript:void(0)" class="easyui-linkbutton" style="width:100%;height:35px" onclick="$('#dlg1').dialog('close')">确定</a>
			</div>
		</div>
		
		<div id="aler" class="easyui-dialog" style="padding:20px 6px;width:80%;" data-options="inline:true,modal:true,closed:true,title:'提示'">
			<center><div>请您点评一下味道！</div></center>
			<div class="dialog-button">
				<a href="javascript:void(0)" class="easyui-linkbutton" style="width:100%;height:35px" onclick="$('#aler').dialog('close')">确定</a>
			</div>
		</div>
		
		<input  id="foodid" type="hidden" th:value="${foodid}" />
		<input  id="orderid" type="hidden" th:value="${orderid}" />
        
	</div>
	
</body>
</html>